package cn.edu.buaa.cnsatm.traffic_big_data_server.waterway.controller;

import cn.edu.buaa.cnsatm.traffic_big_data_server.waterway.service.SeaStatusService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;
import java.text.ParseException;
@RestController
public class SeaStatusController {
    /**
     * @author LX
     * @return 见接口文档
     * @description 返回高度前k的浪的海域
     * @since 2019-10-19
     */
    @RequestMapping("/seaStatus")
    @ResponseBody
    public String webTopKWaveHeight(
            @RequestParam(value = "top_num",required = true,defaultValue = "8") Integer k
    ) throws SQLException, ParseException {
        //System.out.println("hello");
        return SeaStatusService.getTopKWaveHeightFromDatabase(k);
    }

    /**
     * @author LX
     * @return 见接口文档
     * @description 返回所有海域格子的浪高信息
     * @since 2019-12-2
     */
    @RequestMapping("/seaMap")
    @ResponseBody
    public String webCellWaveHeight(
    ) throws SQLException, ParseException {
        //System.out.println("hello");
        return SeaStatusService.getSeaStatusMap();
    }
}
